const p1 = new Promise(resolve => setTimeout(() => resolve("快"), 100));
const p2 = new Promise(resolve => setTimeout(() => resolve("慢"), 200));
Promise.race([p1, p2]).then(v => console.log(v)); // 输出 "快"（p1先完成）

const p3 = new Promise((_, reject) => setTimeout(() => reject("超时"), 150));
Promise.race([p1, p3]).then(v => console.log(v)); // 输出 "快"（p1先成功）